// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Requests;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using Elastic.Transport;
using Elastic.Transport.Extensions;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.Security;

public sealed partial class ClearCachedRealmsRequestParameters : RequestParameters
{
	/// <summary>
	/// <para>
	/// Comma-separated list of usernames to clear from the cache
	/// </para>
	/// </summary>
	public ICollection<string>? Usernames { get => Q<ICollection<string>?>("usernames"); set => Q("usernames", value); }
}

/// <summary>
/// <para>
/// Evicts users from the user cache. Can completely clear the cache or evict specific users.
/// </para>
/// </summary>
public sealed partial class ClearCachedRealmsRequest : PlainRequest<ClearCachedRealmsRequestParameters>
{
	public ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Serverless.Names realms) : base(r => r.Required("realms", realms))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "security.clear_cached_realms";

	/// <summary>
	/// <para>
	/// Comma-separated list of usernames to clear from the cache
	/// </para>
	/// </summary>
	[JsonIgnore]
	public ICollection<string>? Usernames { get => Q<ICollection<string>?>("usernames"); set => Q("usernames", value); }
}

/// <summary>
/// <para>
/// Evicts users from the user cache. Can completely clear the cache or evict specific users.
/// </para>
/// </summary>
public sealed partial class ClearCachedRealmsRequestDescriptor : RequestDescriptor<ClearCachedRealmsRequestDescriptor, ClearCachedRealmsRequestParameters>
{
	internal ClearCachedRealmsRequestDescriptor(Action<ClearCachedRealmsRequestDescriptor> configure) => configure.Invoke(this);

	public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Names realms) : base(r => r.Required("realms", realms))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "security.clear_cached_realms";

	public ClearCachedRealmsRequestDescriptor Usernames(ICollection<string>? usernames) => Qs("usernames", usernames);

	public ClearCachedRealmsRequestDescriptor Realms(Elastic.Clients.Elasticsearch.Serverless.Names realms)
	{
		RouteValues.Required("realms", realms);
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
	}
}